<?php

namespace App\Http\Requests;

use App\Models\ClientUserTicket;
use Illuminate\Foundation\Http\FormRequest;

class PasswordResetRequest extends BasicRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
    	$client = new ClientUserTicket();
		$auth = $client->checkLogin();
        return $auth;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'password_old'		=> 'bail|required|min:6|max:32',
			'password_new'		=> 'bail|required|min:6|max:32|confirmed',
			'password_new_confirmation'=> 'required',
        ];
    }
    
    public function messages()
	{
		return [
			'password_old.required'		=> '请填写原登录密码',
			'password_old.min'			=> '原登录密码最少为6位数',
			'password_old.max'			=> '原登录密码超出最大字符限制',
			'password_new.required'		=> '请填写新登录密码',
			'password_new.min'			=> '新登录密码最少为6位数',
			'password_new.max'			=> '新登录密码超出最大字符限制',
			'password_new.confirmed'	=> '两次密码输入不一致',
			'password_new_confirmation.required'	=> '请再次输入新密码',
		];
	}
}
